package com.ddyx.common.util;

import java.util.Map;
import java.util.UUID;

import org.apache.commons.beanutils.BeanUtils;

/**
 * @author cj
 */
public class BeanUtil {

	@SuppressWarnings("rawtypes")
	public static <K> K parseBean(RequestForm requestForm, K k) throws Exception {
		if (requestForm == null) {
			return null;
		}
		Map data = (Map) requestForm.getData();
		if (data == null) {
			return null;
		}
		BeanUtils.populate(k, data);
		return k;
	}
	
	public static String createId(){
		return UUID.randomUUID().toString();
	}
}
